“crtfile”

Information

The example shown in this file appears at: http://www.hdfgroup.org/HDF5/Tutor/crtfile.html (accessed 10 July 2011)

The example shown in this file is following the tutorial: http://www.hdfgroup.org/HDF5/Tutor/introductory.html

Good references for the shown HDF5 functions include:
http://www.hdfgroup.org/HDF5/doc/RM/RM_H5Front.html
http://www.hdfgroup.org/HDF5/doc/RM/

Prepared 10 July 2011 by Scot Martin for Windows 7, 64-bit, Mathematica version 8.0.1.

“c” code we seek to replicate in this example

#include "hdf5.h"
   #define FILE "file.h5"

   int main() {

      hid_t       file_id;   /* file identifier */
      herr_t      status;

      /* Create a new file using default properties. */
      file_id = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);

      /* Terminate access to the file. */
      status = H5Fclose(file_id); 
   }

Implementation in Mathematica

SetDirectory[NotebookDirectory[]]

Needs["HDF5`"]

file=FileNameJoin[{Directory[],"file.h5"}]

fileID=H5Fcreate[file,H5FuACCuTRUNC,H5PuDEFAULT,H5PuDEFAULT]

H5Fclose[fileID]